package org.csu.pet_store_2.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.csu.pet_store_2.Domain.Order;
import org.csu.pet_store_2.Service.OrderService;
import org.csu.pet_store_2.persistence.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    public int createValidOrderId(){
        QueryWrapper<Order> wrapper = new QueryWrapper<>();
        wrapper.select("max(orderid) as orderid");
        Order order = orderMapper.selectOne(wrapper);
        return order.getOrderid();
    }
}
